package com.tanhua.server.job;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.server.mapper.UserInfoMapper;
import com.tanhua.server.pojo.User;
import com.tanhua.server.pojo.UserInfo;
import com.tanhua.server.service.UserInfoService;
import com.tanhua.server.utils.UserThreadLocal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VoiceJob {


    @Autowired(required = false)
    private UserInfoMapper userInfoMapper;


    @Autowired
    private UserInfoService userInfoService;

    @Scheduled(cron = "0 0/1 * * * *")
    public void run() {
      /*  User user = UserThreadLocal.get();
        UserInfo userInfo = userInfoService.queryUserinfoById(user.getId());*/

        List<UserInfo> userInfoList = userInfoService.queryUserinfoList(new QueryWrapper());
        for (UserInfo userInfo : userInfoList) {
            userInfo.setTimes(10);
            userInfoService.updateUserInfoByUserId(userInfo);
        }

    }
}
